﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BuildPlannerLib.Buildings
{
    // Derived class from Building for all buildings that have production
    public class ProductionBuilding : Building
    {
        // List field for individual production buildings
        public List<IndividualBuilding> IndividualBuildings;

        // Basic constructor
        public ProductionBuilding()
        {
        }

        // Constructor with parameters for name, cost, time duration, and supply produced
        public ProductionBuilding(string name, int mineralCost, int gasCost, int timeDuration)
        {
            Name = name;

            MineralCost = mineralCost;
            GasCost = gasCost;
            TimeDuration = timeDuration;

            IndividualBuildings = new List<IndividualBuilding>();
        }

        // Constructor with parameters for name, cost, time duration, supply produced, and requirement
        public ProductionBuilding(string name, int mineralCost, int gasCost, int timeDuration, string requirement)
        {
            Name = name;

            MineralCost = mineralCost;
            GasCost = gasCost;
            TimeDuration = timeDuration;

            Requirement = requirement;

            IndividualBuildings = new List<IndividualBuilding>();
        }

        // Overrides GetCount() to return the number of objects in the IndividualBuildings list
        public override int GetCount()
        {
            return IndividualBuildings.Count();
        }

        // Overrides AddBuilding() to add a new instance of IndividualBuilding to the IndividualBuildings list
        public override void AddBuilding()
        {
            IndividualBuildings.Add(new IndividualBuilding());
        }

        // Overrides Reset() to clear the IndividualBuildings list
        public override void Reset()
        {
            IndividualBuildings.Clear();
            Started = 0;
        }
    }
}
